//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package com.lyq.bean.mySql;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class SeekExist_Sql {
    public SeekExist_Sql() {
    }

    public Boolean seekExist_Sql(String name, String sort) {
        (new MysqlLinking()).getLink();
        Connection conn = MysqlLinking.conn;
        Boolean bool = false;
        String sqlname = "";
        String tablename = "";
        if (sort.equals("管理员")) {
            sqlname = "manager";
            tablename = "M_Name";
        } else if (sort.equals("学生")) {
            sqlname = "student";
            tablename = "S_No";
        } else if (sort.equals("教师")) {
            sqlname = "teacher";
            tablename = "T_No";
        } else if (sort.equals("课程")) {
            sqlname = "course";
            tablename = "C_No";
        }

        if (conn != null) {
            try {
                String sql = "select * from " + sqlname + " where " + tablename + "=?";
                PreparedStatement ps = conn.prepareStatement(sql);
                ps.setString(1, name);

                for(ResultSet rs = ps.executeQuery(); rs.next(); bool = true) {
                }
            } catch (Exception var10) {
                Exception e = var10;
                e.printStackTrace();
            }
        } else {
            System.out.println("数据库连接错误！");
        }

        return bool;
    }
}
